# -*- coding: utf8 -*-
import os, time#, sys
from pylib import android_commands, surface_stats_collector

resultList = []
deviceText = os.popen('adb devices')
textList = deviceText.readlines()
deviceName = textList[1].split()[0]
adb = android_commands.AndroidCommands(deviceName)
collector = surface_stats_collector.SurfaceStatsCollector(adb, activityName,0.5)
collector.DisableWarningAboutEmptyData()
collector.Start()
for i in range(50):    #循环50次，主要方便自己的实现，其他实现方法请另行实现；
    time.sleep(0.3)
    results = collector.SampleResults()
    if not results:
        pass
    else:
        resultList.append(int(results[0].value))
        results[0].print_str()
collector.Stop()
a = resultList[3:-3]
print(u"平均值："+str(float(sum(a)/len(a)))+u" ; 最小值："+str(min(a)))